package com.enhinck.dbutilweb.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import javax.annotation.PostConstruct;

/**
 * <p>write your description here
 *
 * @author xiaomi（huenbin xiaomi.hu@tuya.com）
 * @since 2022-07-20 18:14
 */
@Slf4j
@Configuration
public class Test {



   @Bean
   @Scope("prototype")
    public BeanA beanA(){
        return new BeanA();
    }

    @Bean
    public BeanB beanB(){
        BeanB b =  new BeanB();
        b.setBeanA(beanA());
        b.setBeanA2(beanA());
        return b;
    }

   // @Autowired
    BeanA beanA;
    @Autowired
    BeanB benB;

    @PostConstruct
    public void init(){
        log.info("beanB.beanA:{}",benB.getBeanA());
        log.info("beanB.beanA:{}",benB.getBeanA2());
    }





}
